﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;

namespace Jet.Dal.EF.Tests.DataObjects
{
	/// <summary>
	/// Information about order details from Northwind database
	/// </summary>
	[DebuggerDisplay("OrderID = {OrderID} ProductID = {ProductID}")]
	[Table("Order Details")]
	public class OrderDetails
	{
		[Key, Column(Order =0)]
		public int OrderID { get; set; }

		[ForeignKey("OrderID")]
		public virtual Order Order { get; set; }

		[Key, Column(Order = 1)]
		public int ProductID { get; set; }

		[ForeignKey("ProductID")]
		public virtual Products Product { get; set; }

		[Column]
		public decimal UnitPrice { get; set; }
		
		[Column]
		public Int16 Quantity { get; set; }
		
		[Column]
		public Single Discount { get; set; }

		public override string ToString()
		{
			return String.Format("Order details: Product='{0}' order='{1}' price ='{2}' quantity = '{3}'",
				ProductID, OrderID, UnitPrice, Quantity);
		}
	}
}
